import request from "@/utils/request"

export function loginSecurity(username, password, captcha) {
  // 登录接口
  return request({
    url: "/user/login",
    method: "POST",
    data: {
      username,
      password,
      captcha
    }
  })
}
// 获取公钥
export function getPublicKey(obj) {
  return request({
    url: "/getPublicKey",
    method: "get",
    params: obj
  });
}
export function loginByCode(userinfo) {
  return request({
    url: "/OauthAccessToken/oauth",
    method: "post",
    data: userinfo
  })
}

export function loginByUsername(username, password) {
  return request({
    url: "/user/login",
    method: "get",
    data: {
      username,
      password
    }
  })
}

export function logout() {
  return request({
    url: "/user/logout ",
    method: "get"
  })
}

export function getUserInfo(token) {
  // 登录用户信息
  return request({
    url: "/user/queryBytoken",
    method: "get",
    params: {
      token
    }
  })
}

export function getNav() {
  // 获得侧边导航数据
  return request({
    url: "/permission/findUserMenu",
    // url:url,
    method: "get"
    // params: {
    //   token
    //   // vPaf : "werdfgh"
    // }
  })
}

export function metaGetNav(token) {
  // 获得侧边导航数据
  return request({
    url: "/dirUuWidthPermission/findAllPermission",
    method: "get",
    params: {
      token
      // vPaf : "werdfgh"
    }
  })
}

export function zcCommit(url, obj) {
  // 注册接口
  return request({
    url: url,
    method: "post",
    data: obj
  })
}

export function getUser(url) {
  // 登录用户
  return request({
    url: url,
    method: "get"
  })
}
export function isShouquan() { // 判断是否授权
  return request({
    url: "/license",
    method: "get"
  })
}

export function Shouquan(code) { // 权
  return request({
    url: "/importlicense/" + code,
    method: "get"
  })
}
